package com.ghy.seckill.mq;

import com.ghy.seckill.service.OmsOrderItemService;
import com.ghy.seckill.vo.OrderVo;
import com.rabbitmq.client.Channel;

import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;



/**
 * @Description: 定时关闭订单
 **/

@RabbitListener(queues = "order.release.order.queue")
@Service
public class OrderCloseListener {
    @Autowired
    private OmsOrderItemService orderItemService;

    @RabbitHandler
    public void listener(String orderSn) {
        System.out.println("收到过期的订单信息,超时未消费，准备关闭订单" + orderSn);
        //调用订单服务方法，删除超时订单
        orderItemService.closeOrder(orderSn);
    }

}
